<?php
namespace Application\Form;

use Zend\Form\Form;

class LoginForm extends Form{
	
 public function __construct($capture_url)
    {
        parent::__construct('Login');
        $this->setAttributes(array(
            'method' => 'post'
        ));

        $this->add(array(
            'name' => 'password',
        	'type'  => 'Password',
         	'options' => array(
                    'label' => 'Password:',
                )
        ));
        
        $this->add(
        	array(
	        	'name'=>'username',
        		'type'=>'Text',
	        	'options'=>array(
	        		'label'=>'name:'
	        	),
        	)
        );

        $captcha = new \Zend\Captcha\Image();
        $captcha->setImgDir('./public/captcha');
        $captcha->setImgUrl($capture_url);
        $captcha->setFont('./public/captcha/font/arial.ttf');



        $this->add(array(
            'type' => 'Captcha',
            'name' => 'captcha',
            'options' => array(
                'label' => 'Captcha',
                'captcha' => $captcha,
            ),
            'attributes' => array(
            	'id'=>'imgpng'
            )
        ));

        $this->add(array(
            'name' => 'submit',
        	'type'  => 'Submit',
            'attributes' => array(                
                'value' => 'Login',
            ),
        ));
	}
}